﻿using System;
using System.Collections.Generic;
using System.IO.Ports;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Company.Communication.Serial
{
    public interface ISerialCommunication
    {
        // 端口号
        public string PortName { get; set; }
        // 波特率
        public int BaudRate { get; set; }
        // 返回数据
        public string ReceivedData { get; set; }
        // 串口是否打开
        public bool IsOpen { get; }
        // 打开端口
        public void OpenPort();
        // 发送数据
        public void SendData(string data);
        // 关闭端口
        public void ClosePort();
        // 接收数据回调
        public delegate void DataReceivedCallback(string data);
        // 接收数据事件
        public event DataReceivedCallback DataReceivedEvent;
    }
}
